package com.xinqi.modules.chat.chat.official.controller.inner;

import com.xinqi.common.base.response.R;
import com.xinqi.modules.chat.chat.official.dto.req.ChatAssistantContentCreateDTO;
import com.xinqi.modules.chat.chat.official.dto.req.ChatAssistantContentMainDTO;
import com.xinqi.modules.chat.chat.official.dto.req.ChatAssistantContentTotalDTO;
import com.xinqi.modules.chat.chat.official.dto.req.ChatAssistantContentUpdateDTO;
import com.xinqi.modules.chat.chat.official.service.ChatAssistantContentService;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.Objects;


/**
 * 接口 -- 新奇提醒消息记录
 *
 * @author: yyzhen
 * @date: 2023/05/06
 */
@Validated
@Hidden
@RestController
@RequestMapping("/inner/assistant-content")
@RequiredArgsConstructor
public class ChatAssistantContentInnerController {

    private final ChatAssistantContentService chatAssistantContentService;

    /**
     * 新奇助手发送消息
     */
    @Operation(summary = "新奇助手发送消息")
    @PostMapping("/batchInsert")
    public R<Boolean> batchInsert(@Validated @RequestBody List<ChatAssistantContentCreateDTO> dto) {
        if (Objects.nonNull(dto)) {
            return R.data(chatAssistantContentService.batchInsert(dto));
        } else {
            return R.error("发送消息内容为空");
        }
    }

    /**
     * 新奇助手更新主体消息
     */
    @Operation(summary = "新奇助手更新主体消息")
    @PostMapping("/batchUpdateMain")
    public R<Boolean> batchUpdateMain(@Validated @RequestBody ChatAssistantContentMainDTO dto) {
        return R.data(chatAssistantContentService.batchUpdateMain(dto));
    }

    /**
     * 新奇助手更新统计消息
     */
    @Operation(summary = "新奇助手更新统计消息")
    @PostMapping("/batchUpdateTotal")
    public R<Boolean> batchUpdateTotal(@Validated @RequestBody List<ChatAssistantContentTotalDTO> dto) {
        return R.data(chatAssistantContentService.batchUpdateTotal(dto));
    }

    /**
     * 新奇助手更新消息
     */
    @Operation(summary = "新奇助手更新消息")
    @PostMapping("/batchUpdate")
    public R<Boolean> batchUpdate(@Validated @RequestBody List<ChatAssistantContentUpdateDTO> dto) {
        return R.data(chatAssistantContentService.batchUpdate(dto));
    }


}
